// 定义token
const tokenkey = 'webApp-token'

// 保存token
const setToken = token => {
  return window.localStorage.setItem(tokenkey, JSON.stringify(token))
}

// 删除token
const removeToken = () => {
  return window.localStorage.removeItem(tokenkey)
}

// 获取token
const getToken = () => {
  return JSON.parse(window.localStorage.getItem(tokenkey))
}

// 暴露接口
export { setToken, removeToken, getToken }
